{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### Problem 15"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(45, 135, array([-3.       ,  3.0841436, -1.583081 ,  2.391305 ,  4.5287635]))\n"
     ]
    }
   ],
   "source": [
    "import numpy as np\n",
    "import matplotlib.pyplot as plt\n",
    "import helper as hlp\n",
    "plt.rcParams['font.sans-serif']=['SimHei'] #用来正常显示中文标签\n",
    "plt.rcParams['axes.unicode_minus']=False #用来正常显示负号\n",
    "\n",
    "#读取数据\n",
    "data = np.genfromtxt(\"data.txt\")\n",
    "#获取维度\n",
    "n, d = data.shape\n",
    "#分离X\n",
    "X = data[:, :-1]\n",
    "#添加偏置项1\n",
    "X = np.c_[np.ones(n), X]\n",
    "#分离y\n",
    "y = data[:, -1]\n",
    "\n",
    "#problem 15    \n",
    "print(hlp.PLA(X, y))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### Problem 16"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "D:\\Anaconda3\\lib\\site-packages\\matplotlib\\axes\\_axes.py:6521: MatplotlibDeprecationWarning: \n",
      "The 'normed' kwarg was deprecated in Matplotlib 2.1 and will be removed in 3.1. Use 'density' instead.\n",
      "  alternative=\"'density'\", removal=\"3.1\")\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYAAAAETCAYAAAA/NdFSAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvOIA7rQAAHLVJREFUeJzt3XucXWV97/HPNwmXkCCEZgzGW0SjrTVE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7SU8Gez7wWeB9wC+AL0l6Y7PjC2a7m28GZ9WQNKEd59tLmhQRj+RxARMi4tEdr8P/CK1NHABmZpXyQWAzs0o5AMzMKuUAMDOrlAPAzKxSDgAzs0r9fzYPjA/Te7rEAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "#problem 16\n",
    "hlp.f1(hlp.PLA, X, y, 2000, 1)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### Problem 17"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXsAAAETCAYAAADXmaY8AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvOIA7rQAAF1tJREFUeJzt3Xu0HnV97/H3JwlITCiEEsOhXiKKtiqCGJFYauMFLODtYC3UC3IqjVpQe6zVKGm9oQJH6fJSWiOpx1bURqtRpB6jKII2qEkVvKDVwwkqLjQIEqOCgN/zx0zMZrt39uwkm03ye7/WetaaZ57vzPyeCXxmnt9vZnaqCknS7m3GdDdAkjT1DHtJaoBhL0kNMOwlqQGGvSQ1wLDXnSrJ3kky3e2QWmPYa1KSzEwycxufz0oyY8T7f01y4oiSNwAvH2fZA5LMn2R7/izJ88fZ9owke454n1HLLknyd9tY9+lJ9kry6SSHJPnrJL+V5B1JHj2gbccmWTSZ7yNNFcNek3UcsD7Juv71/SQ/6KfXA18GDhlRfzPwyxHvHwO8b5x1HwFcmOTuSY5JclWSLydZn+QrSb6dZN6W4iT3BM4A1vSzlgJb2rUOWA+s6GsDfDbJQ0ds72nAN7fxXWcBy4HbgDnASVW1CX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IDHKCVpAYY9pLUAMNekhpg2EtSAwx7SWrA/we+aGkk51ojNQAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "#problem 17\n",
    "hlp.f1(hlp.PLA, X, y, 2000, 0.5)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### Problem 18"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXsAAAETCAYAAADXmaY8AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvOIA7rQAAHJZJREFUeJzt3XuYXFWd7vHvSwgIATGQNnIRA5gxcoYEsYXkiGPDAyjghWGYE7wj5IThCKPjMBIMjgMPIHjhyCAXM1zlOUYBFWUQQSGRiNw6cpfxHuRitBGGgDqA4Xf+WKsnm6Kqu3pXV7qb9X6ep57sWrX23r/enX5r19q79lZEYGZmL24bjHUBZmbWfQ57M7MCOOzNzArgsDczK4DD3sysAA77gknaXJLGug4z6z6H/QQmaZKkSUO8vqGkDSrPvyppfqXLqcBxQ8z/Xkmvrjz/oKStJfVIel9D39dImlrvJwFJn5T03hH0319Sb931mZXGYT+xHQCslNSfHw9JeiRPrwTuAHap9P8v4JnK872Apc0WLKkHOIPn/x/5W2AqMA1Y0DDLG4DvS9pO0gJJD1bq6pf0qKTXV5Z/gaQbJS2XtBx4P/CZweeSVkj6RkNNn5K0d376buD1tCDp7yStzuveoVW/hnnOl3RYQ9tbJF0j6SpJu1faT5L0O0nXS9oyt20k6RuSfiPpHkl7DNU+zHqbLX+SpH+TNCDpckkb5/Ypkq7M/c+pLGO6pO/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Q2BbYyUFv44n37K0Ykl5B2mM/lBTsf0P6puovSF+6+y1wFemqo2eQvtX4EtKFygZtFPlaRZI2IX1KGLxi5c9JnxQOAL6Z3zTMxgXv2VtJ/gjcSrpk9H3AlaSwH/SHiLhf0u9JfxszgZ2B3Ul79d8BJku6JAf5LFK4HwccQbrA2r+RrlD5MuDC9fFDmbXDYW8l2ZQU7puThl12AP4K+H5+/Qief8GxY0khvx1pHH4r0p7+BpIuJ30CWAycD2yR+z8LnAC8S9JGEfFMl38ms7Y47K0YEbFa0jdI1yd5mhTgewGvzV2qwy7vJA313Ad8jxTih0a+CqHS3c52AC7I/XtIbyIPk66/NJl0H4LOL2BlNgoc9laajYH9STcHuR04LSIuBpB0de7zatIe/GrSGTn/Srpa4dclfSwi+iPiQirDNJI+AqyOiK+sp5/DbER8nr2VZmvSLeD+kbT3vUjpfr/LSVcohHTGzdHARaQ3g8si4jbSsM1x+RTMRhvjnScbx3w2jplZAbxnb2ZWAIe9mVkBHPZmZgVw2JuZFcBhb2ZWgP8PKoLJNusfd28AAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "import matplotlib.pyplot as plt\n",
    "import numpy as np\n",
    "import helper as hlp\n",
    "plt.rcParams['font.sans-serif']=['SimHei'] #用来正常显示中文标签\n",
    "plt.rcParams['axes.unicode_minus']=False #用来正常显示负号\n",
    "\n",
    "data_train = np.genfromtxt(\"hw1_18_train.txt\")\n",
    "data_test = np.genfromtxt(\"hw1_18_test.txt\")\n",
    "\n",
    "X_train, y_train = hlp.preprocess(data_train)\n",
    "X_test, y_test = hlp.preprocess(data_test)\n",
    "\n",
    "#problem 18\n",
    "hlp.f2(hlp.Pocket_PLA, X_train, y_train, X_test, y_test, 2000, max_step=50)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### Problem 19"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAWwAAAETCAYAAAAS6zytAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvOIA7rQAAFMhJREFUeJzt3X+UZGV95/H3hxkGAREGpwMKJw4gEYwIwgQFFzJ4JEclijHuDoqSRAjIYo7ZLEfGX9nEVUOCsnFdMbAQIdGgQESCHI34YxgSQeyJRFY8WU0yQsTBwfBDkQgL3/3j3jZl2zNdPXR199Pzfp1zz7n31lN1v09XzaeeeuremlQVkqSFb4f5LkCSNBwDW5IaYWBLUiMMbElqhIEtSY0wsPW4JNktSea7Dml7YGBv55IsSbJkK7cvTbLDwPbHkqwZaPJu4Jyt3P81SZ4+sP0bSZ6SZCzJaye1fUaS5dvWE0jy35K8ZgbtX5xk1bYeT5prBrZeAmxIMt4v/5Lkrn59A/AV4JCB9v8GPDywfRxw+VQPnGQMOJ+ffJ39R2A5sAI4bdJdfgG4Icm+SU5LcudAXeNJ7klyxMDjX5JkfZJ1SdYBpwDnTWwnuTHJ1ZNq+oMkL+g3Xw0cwRYkeX2STf2x99tSu4H2Jyf5bJIrkxzY79s7yb/1j7MpyRX9/mVJrk7ynSS3JXnu1toPHOPoJF9LsnRg3/uTPJjk7iSvnq5ONayqXLbzBTgRWNqvrwXe2a/vArwZWDLQ9lLg5f36M4DHgE2TlicNtP0OsAF4JXAj8K/99jhwP/D3wG4Dj/9S4EjgtcDZk+q8FDhkYHt/YO9+/eeA9cBOwM79vp8HDpr0GM8F7gaeD1wFvHgLf5NDgG8DTwWOAq6b5m/4/L5PBwO/BdzU738RcOEU7c8C3tGvvwT4P1tr39+2BLh1sGbgVcBngb2BXwQeAHaa79eUy2gWR9iCbqT5x1PsPwd4blU9mu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n0X3iuQ1413zX/Dj7shvdIGc93Xck+8x33Y/3dQa8G3jFKGoY+ZWOi+my9sXUF1hc/bEvC9Ni6gvMf3+8NF2SGtHyl4CStF0xsCWpEQa2FqUkB8x3DdJsM7DVnCQHJ/n4wPZVSXZI8r4kK/vd705ySpKDkmxM8tl+2TB4cUZ/pd3E+huTnDSwvVCvINR2yi8d1ZwkfwmsBK6jOy1sDfBF4Ajgn4A3AHcCbwQ+BpxWVWv7+64GDqqqP+m3vww8BDwG/Cxwx8RhgF2AY6vqobnolzQdRxBqSpJT6S62+DXgsar6YZL9quqV/cUw7wTurKpHgXcleQZwUpKJ/9F6OXDpwEN+GrgFWAEcQBf4dwL7AAcY1lpIHGGrKUn2phs5n0QXzr8K7Af8I/A04G7gWuAMugscrgSeQPcjYxOWVdVd/ePtTDdan/jFyG/SjdhfAlzTB7+0IDjCVmt+CHwJOAT4Gt1/Er3fwO0PVtXXk3yP7vV9IPBMul8bXE43ot4xyWV9GB9EF9DnAKcCF9L9etx9dJfj/+lcdEoahoGt1uxCF9C70U1h7AccC9zQ334q3ZVoE86mC+p96ealn0w34t4hyZV0I/G3AhcDu/ftHwHeBrwqybKqenjEfZKGYmCrKVW1KcnVdL/j8CO6ED4OOLhvMjiFcSLdtMnXgM/SBfFJ1f9iX5LX0QX+JX37Mbo3gm8D76P76dJ76MJcmncGtlq0E/Bi4Ht0vw19blVdCpDkur7N0+lG0pvozhT5n3S/rvbxJG+qqvGq+lMGpjyS/Dawqao+Okf9kGbE87DVoqfQ/Vds/5VuFLx24v/Ro/tFNejOBHkD8CG6QL+iqm6hmwI5pz+9b7KdcBCjBcyzRCSpEY6wJakRBrYkNcLAlqRGGNiS1AgDW5Ia8f8BFzxSYPfySNEAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "#problem 19\n",
    "result = hlp.f2(hlp.PLA, X_train, y_train, X_test, y_test, 2000, 1, max_step=50)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### Problem 20"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXEAAAETCAYAAADAuzb1AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvOIA7rQAAGQ1JREFUeJzt3XmYXFWdxvHvSxZIwiKQNoKICcsQFwhCi0QiNkxAkAEdRIOKyGYcRnBlIEhc4EEFlSijokYCQVQ0IKAICggGENk6A6KAgksQEoNhC7KoCL/545w2l6a7q1JdleqTfj/PU0/uPXXvrd+pSr916t5btxQRmJlZmdZqdwFmZtY4h7iZWcEc4mZmBXOIm5kVzCFuZlYwh/gaSNJ6ktTuOsys9RziQ5CkEZJGDHD/SElrVea/J2lGZZFPA8cNsP5BkraqzB8qaRNJHZLe1WvZbSRt2FhPQNInJB20CsvvLamz0cczG24c4kPTG4FFkrrz7X5JS/P0IuBWYNvK8n8D/lGZ3w04r68NS+oA5vDc1/6twIbAeOCIXqu8GrhG0maSjpB0X6WubkkPStqxsv15kq6VtFDSQuBg4HM985Kuk3RRr5o+I2n3PPsOYEf6Iem/JC3Ljz2pv+V6rXOmpEP6aJ8t6ZP9rHOopPmV+VdL+oGkyyXtXWm/K9ezTNL9dSzfZ/2STpL0F0lXSdoot42Q9A1JyyWdL2nt3D5O0sV5+TMq25gg6Zq8/RMq7ZMl3SppSfV5kLSLpLsl/VHSXpX2N0v6U+7bDg3WPlrSAkl/k7RY0vS+Xx0btIjwbQjegDcBI/P0LODkPD0WOB4YUVl2PvDmPL0N8CywrNdt/cqyfwYWAQcA1wEP5/luYAXwS2C9yvb3BXYC3gUc06vO+cC2lf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+w3nuBZiOIYX3ZqT93BuTRuZrSTqfNGI/ATgT2CAv/zQwG3i7pNER8Y8W98msLg5xK15ELJN0EelaF38nBfNuwMvyItXdH28i7XK5A/gpKZwPjIhHAfKvRU0C5uXlO0hvDktI1+sZRbqu+5kt7JJZ3RzitqZYG9ib9GMEtwCnRMR8AEmX5mW2Io24l5HOUPlf0hXnLpR0bER0R8RZVHaXSPogsCwivrua+mG2SnyeuK0pNiH9bNZHSKPlWfn3SReSrjIH6QyUo4CzSSG/ICJuJu0+OS6fatjb2niwY0OYz04xMyuYR+JmZgVziJuZFcwhbmZWMIe4mVnBHOJmZgX7f1QQesJeVwhUAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "#problem 20\n",
    "hlp.f2(hlp.Pocket_PLA, X_train, y_train, X_test, y_test, 2000, max_step=100)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.1"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
